Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unbound global variables in pywin.dialogs.ideoptions.OptionsPropPage's OnFormat* methods + re-enable pyright's reportUnboundVariable #2283

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Jun 4, 2024

Looking at the implementation of interact.SaveFontPreferences this almost certainly meant to use the variables in interact. Although these still fail because calling self.GetFormat results in AttributeError: 'PyCPropertyPage' object has no attribute 'GetFormat':

>>> from pywin.dialogs import ideoptions; ideoptions.OptionsPropPage().OnFormatInput(None,None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python39\lib\site-packages\Pythonwin\pywin\dialogs\ideoptions.py", line 122, in OnFormatInput
    fmt = self.GetFormat(formatInput)
  File "C:\Program Files\Python39\lib\site-packages\Pythonwin\pywin\mfc\object.py", line 24, in __getattr__
    return getattr(o, attr)
AttributeError: 'PyCPropertyPage' object has no attribute 'GetFormat'

For all I know these methods might always have been broken in the past 25 years. At least this allows us to turn on reportUnboundVariable in pyright.

CHANGES.txt Outdated Show resolved Hide resolved
@Avasam Avasam changed the title Fixed unbound global variables in pywin.dialogs.ideoptions.OptionsPropPage's OnFormat* methods Fixed unbound global variables in pywin.dialogs.ideoptions.OptionsPropPage's OnFormat* methods + re-enable pyright's reportUnboundVariable Oct 4, 2024
@Avasam Avasam requested a review from mhammond October 18, 2024 18:40
pyrightconfig.json Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant